<template>
  <div class="info">
    <div class="personalTop">
      <div class="title">修改密码</div>
      <div class="tips">修改或设置您的账号密码</div>
    </div>
    <el-divider></el-divider>
    <div class="cont">
      <el-form
        ref="form"
        :model="form"
        class="formWaip"
        label-position="top"
      >
        <el-form-item label="旧密码：">
          <el-input
            v-model="form.currentpwd"
            type="password"
            placeholder="请输入当前密码"
          ></el-input>
        </el-form-item>
        <el-form-item label="新密码：">
          <el-input
            v-model="form.newpwd"
            type="password"
            placeholder="请输入新密码"
          ></el-input>
        </el-form-item>
        <el-form-item label="新密码确认：">
          <el-input
            v-model="form.againnewpwd"
            type="password"
            placeholder="请再次输入新密码"
          ></el-input>
        </el-form-item>
      </el-form>

      <div style="text-align: center">
        <el-button plain type="primary" @click="submitForm"
          >提交保存</el-button
        >
      </div>
    </div>
  </div>
</template>
<script>
import { udpPassword } from "@/api/UserInfo";
import { getUserInfo } from "@/utils/auth";
export default {
  data() {
    return {
      form: {},
    };
  },
  created() {
    this.userInfo = JSON.parse(getUserInfo());
  },
  methods: {
    submitForm() {
      udpPassword(this.form).then((res) => {
        if (res.code == 0) {
          this.$message.success(res.data);
        } else {
          this.$message.error(res.data);
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.info {
  .cont {
    width: 520px;
    margin: 0 auto;
    padding-bottom: 40px;
    ::v-deep {
      .el-form-item {
        margin-bottom: 10px;
      }
      .el-form-item__label {
        padding: 0;
      }
    }
  }
}
</style>